sound object
This method will pause the sound playback.
bool pause()
Parameters:
None.
Return value:
true on success, false on failure.
Remarks:
This method will stop the playback of the sound, without resetting its position to the beginning of the file. Thus, it will continue from the exact point at which it was paused the next time the "play" method is called.
Example:
// Play a sound and let the user pause and unpause it with the space bar, stop it with enter and exit with escape.
void main()
{
sound ambience;
show_game_window("Sound Test");
ambience.load("curry.wav");
if(ambience.active==false)
{
alert("Error", "The sound could not be loaded.");
exit();
}
ambience.play();
while(true)
{
if(key_pressed(KEY_SPACE))
{
if(ambience.playing==true)
{
ambience.pause();
}
else
{
ambience.play();
}
}
if(key_pressed(KEY_RETURN))
{
ambience.stop();
}
if(key_pressed(KEY_ESCAPE))
{
break;
}
wait(5);
}
}